
    <form id="settingForm" class="checkoutform" action="{:U('updateconfig')}" method="post">
    <input type="hidden" name="template_id" value="{$cur_template_id}" />
    <style>
	
	
	
	#control{margin:0; padding:0;}
		#control li{float:left; height:40px; list-style-type:none; line-height:40px; border:1px solid #558fca; border-bottom:none;}
		#control li a{padding:0px 8px;}
		#control li.cur{background:#558fca;}
		#control li.cur a{color:#fff; font-weight:bold;}
	</style>
   <ul id="control">
   <volist name="setting_list" id="vo">
   	<li <eq name="key" value="0">class="cur"</eq>><a href="javascript:void(0);">{$vo.title}</a></li>
   </volist>
   <div class="clear"></div>
   </ul>
    
   <volist name="setting_list" id="vo">
     <table class="table table-bordered setting_table" width="100%" border="0" <gt name="key" vaule="0">style="display:none;"</gt> cellspacing="0" cellpadding="0">
<volist name="vo['list']" id="svo">
  <tr class="data_list"><td>使用这个配置项<input name="id[]" <if condition="$cur_template[$svo['name']]==$svo['name']">checked="checked"</if> value="{$svo.id}" type="checkbox" /></td><td><input name="sort" type="text" id="sort" value="{$svo.sort}" size="4" maxlength="4" /></td>
  <td><a href="javascript:void(0);" onclick="update_sortClick('id[]','up',this,'sort','{:U('Setting/dosort')}');">上</a><a href="javascript:void(0);" onclick="update_sortClick('id[]','',this,'sort','{:U('Setting/dosort')}');">下</a></td>
  <td align="right">{$svo.remark}</td>
  <td>
  <!--单行文本框-->
    <eq name="svo['type']" value="0">
        <input name="{$svo.name}" value="{$cur_setting[$svo['name']]}" type="text" />
    </eq>
  <!--下拉框-->
    <eq name="svo['type']" value="2">{:dump($svo['_select'])}
        <html:select name="{$svo['name']}" options="svo['_select']" selected="cur_setting[$svo['name']]" />
    </eq>
    <!--编辑框-->
    <eq name="svo['type']" value="3">
        <html:editor id="{$svo['name']}_" name="{$svo['name']}" type="UEDIT" style="width:100%;">{$cur_setting[$svo['name']]}</html:editor>
    </eq>
    <!--多行文本-->
    <eq name="svo['type']" value="1">
        <textarea name="{$svo.name}" cols="60" rows="6">{$cur_setting[$svo['name']]}</textarea>
    </eq>
    <!--上传图片-->
    <eq name="svo['type']" value="4">
        <script>
			function uploaded{$svo.name}(path,name){
				$("#"+name).attr("src",'__PUBLIC__'+path);
				$("input[name='"+name+"']").val(path);
			}
			function del_img{$svo.name}(name){
				if(confirm('您确定要删除图片吗?')){
					var file=$("input[name='"+name+"']").val();
					$.post("{:U('delImgBypath')}",{'path':file},function(data){
						$("input[name='"+name+"']").val('');
						$("#"+name).attr('src','');
					});
				}else{
					return false;
				}
			}
		</script>
        <input type="hidden" name="{$svo.name}" value="{$cur_setting[$svo['name']]}" />
        <iframe frameborder="0" width="400" height="40" scrolling="no" src="{:U('upload',array('name'=>$svo['name']))}"></iframe>
        <img src="<notempty name="cur_setting[$svo['name']]">{:getThumbPath($cur_setting[$svo['name']])}<else/>__PUBLIC__/Admin/images/defaultimg.png</notempty>" id="{$svo.name}" height="50" /><a href="javascript:void(0);" onclick="del_img{$svo.name}('{$svo.name}');">删除</a>
    </eq>
    <!--图片上传结束-->
    <!--布局编辑框-->
    <eq name="svo['type']" value="5">
        <html:editor id="{$svo['name']}" style="width:100%; height:420" name="{$svo['name']}" type="CHENHUIEDITOR" width="100%" height="420">{$cur_setting[$svo['name']]}</html:editor>
    </eq>
    <!-- 布局编辑器结束 -->
    </td>
    
  </tr>
</volist>
</table>

</volist>



</form>

<script>
    $(document).ready(function(e) {
    $('#control li').each(function(index, element) {
        $(this).click(function(e) {
			$(this).parent().find('li').removeClass('cur');
            $(this).addClass('cur');
			$('.setting_table').hide();
			$('.setting_table').eq(index).show();
        });
    });
});


//更新排序,点击移动更新
	function update_sortClick(key,type,el,field,sendurl){
		var data=new Array();
		if(type=='up'){
			$(el).parent().parent().after($(el).parent().parent().prev());
		}else{
			$(el).parent().parent().next().after($(el).parent().parent());
		}
		$("input[name='"+key+"']").each(function(index, element) {
			$(this).parent().parent().find("input[name='"+field+"']").val(index+1);
            data.push($(this).val()+'_'+$(this).parent().parent().find("input[name='"+field+"']").val());
        });
		
		//列新排序
		update_sort(key,field,el,sendurl);
	}

function update_sort(key,field,el,url){
		var data=new Array();
		$("input[name='"+key+"']").each(function(index, element) {
            data.push($(this).val()+'_'+$(this).parent().parent().find("input[name='"+field+"']").val());
        });
		$.post(url,{'sort':data.toString(),'field':field},function(data){
			if(data=='OK'){
				if(el==''){
					success('更新成功');
				}
			}else{
				error('更新失败');
			}
		});
	}
</script>
